package main

import "fmt"

//数组是值类型
func printArray(arr [5]int) {
	arr[0] = 100
	for i, v := range arr {
		fmt.Println(i, v)
	}
}

//使用引用完成数组修改
func printArray2(arr *[5]int) {

}

func main() {
	var array1 [5]int
	array2 := [3]int{1, 2, 3}
	array3 := [...]int{2, 4, 6, 8, 10}
	var grid [4][5]int

	fmt.Println(array1, array2, array3)
	fmt.Println(grid)

	/*
		range关键字
	*/
	for i, v := range array3 {
		fmt.Println(i, v)
	}

	for _, v := range array3 {
		fmt.Println(v)
	}

	for i := range array3 {
		fmt.Println(i)
	}
}
